package 匿名内部类在开发中的使用;

public class JumppingDemo {
    public static void main(String[] args) {
        /*需求：创建接口操作类的对象，调用method方法*/
        JumppingOperator jo = new JumppingOperator();
        jo.method(new Jumpping() {
            @Override
            public void jump() {
                System.out.println("猫可以跳高了");
            }
        });
        jo.method(new Jumpping() {
            @Override
            public void jump() {
                System.out.println("够可以跳高了");
            }
        });
    }
}
interface Jumpping{
    void jump();
}
class Cat implements Jumpping{
    @Override
    public void jump() {
        System.out.println("猫可以跳高了");
    }
}
class Dog implements Jumpping{
    @Override
    public void jump() {
        System.out.println("狗可以跳高了");
    }
}
class JumppingOperator{
    public void method(Jumpping j){
        j.jump();
    }
}